<?php

namespace app\common\validate\merchant;

use yiqiniu\extend\validate\YqnValidate;

class MerchantMemberSalesmanAddressValid extends YqnValidate
{


    /**
     *  验证规则
     */
    protected $rule = [
        'id' => 'require|number|dbExists:merchant_member_salesman_address,id',
        'province' => 'require',
        'city' => 'require',
        'county' => 'require',
        'address' => 'require',
        'real_name' => 'require',
        'mobile' => 'require|mobile',
        'def' => 'require|in:0,1',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => '序号不能为空',
        'id.number' => '序号只能为数字类型',
        'id.dbExists' => '未找到地址信息',
        'province.require' => '请完善地址信息',
        'city.require' => '请完善地址信息',
        'county.require' => '请完善地址信息',
        'address.require' => '请完善地址信息',
        'real_name.require' => '联系人姓名不能为空',
        'mobile.require' => '手机号不能为空',
        'def.require' => '请选择默认状态',
        'def.in' => '请选择默认状态',

    ];


    //验证场景
    protected $scene = [
        'info' => ['id'],
        'del' => ['id'],
        'bind' => ['id'],
        'save' => ['province','city','county','address','real_name','mobile','def'],
    ];

}
